/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bio.jpa.entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "contig", catalog = "biodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contig.findAll", query = "SELECT c FROM Contig c"),
    @NamedQuery(name = "Contig.findByCtgId", query = "SELECT c FROM Contig c WHERE c.ctgId = :ctgId"),
    @NamedQuery(name = "Contig.findByDescription", query = "SELECT c FROM Contig c WHERE c.description = :description"),
    @NamedQuery(name = "Contig.findByCtgLength", query = "SELECT c FROM Contig c WHERE c.ctgLength = :ctgLength")})
public class Contig implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "ctg_id")
    private Integer ctgId;
    @Size(max = 45)
    @Column(name = "description")
    private String description;
    @Column(name = "ctg_length")
    private Integer ctgLength;
    @JoinColumn(name = "gen_bank_id_gen", referencedColumnName = "id_gen")
    @ManyToOne(optional = false)
    private GenBank genBankIdGen;


    public Contig() {
    }

    public Contig(Integer ctgId) {
        this.ctgId = ctgId;
    }

    public Integer getCtgId() {
        return ctgId;
    }

    public void setCtgId(Integer ctgId) {
        this.ctgId = ctgId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getCtgLength() {
        return ctgLength;
    }

    public void setCtgLength(Integer ctgLength) {
        this.ctgLength = ctgLength;
    }

    public GenBank getGenBankIdGen() {
        return genBankIdGen;
    }

    public void setGenBankIdGen(GenBank genBankIdGen) {
        this.genBankIdGen = genBankIdGen;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ctgId != null ? ctgId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contig)) {
            return false;
        }
        Contig other = (Contig) object;
        if ((this.ctgId == null && other.ctgId != null) || (this.ctgId != null && !this.ctgId.equals(other.ctgId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bio.jpa.entities.Contig[ ctgId=" + ctgId + " ]";
    }
    
}
